var _n38;
var cc__extends = __extends;
var cc__decorate = __decorate;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $1$Loader = require("Loader");
var s = cc__importDefault($1$Loader);
var $1$yyComponent = require("yyComponent");
var c = cc__importDefault($1$yyComponent);
var $GameEventType = require("GameEventType");
var $zqcc_OverallSystem = require("zqcc_OverallSystem");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_SignInItem = function (t) {
  function _ctor() {
    // 初始化并返回当前实例或从父类调用的实例
    const instance = null !== t && t.apply(this, arguments) || this;

    // 设置实例的属性
    instance.icon = null;        // 图标
    instance.gameName = null;    // 游戏名称
    instance.yilingqu = null;     // 已领取状态
    instance.data = null;        // 数据

    return instance; // 返回当前实例
  }
  cc__extends(_ctor, t);
  _ctor.prototype.start = function () {
    this.on($GameEventType.EventType.UIEvent.SignInList, this.updataView, this);
  };
  _ctor.prototype.setData = function (t) {
    cc.log(t);
    this.data = t;
    this.updataView();
  };
  _ctor.prototype.updataView = function () {
    const context = this; // 保存当前上下文

    if (this.data) {
      const data = this.data.data; // 获取数据
      const itemData = this.data.wupinData; // 获取物品数据

      // 设置游戏名称
      this.gameName.string = "X" + data["奖励物品数量"];

      // 获取签到列表
      const signInList = $zqcc_OverallSystem.sers().userSrv.getSignInList();
      this.yilingqu.active = false; // 默认隐藏已领取标记

      // 检查当前奖励项是否已领取
      if (signInList.list.indexOf(+data.key) >= 0) {
        this.yilingqu.active = true; // 若已领取则显示
      }

      // 获取签到图标路径并加载图像资源
      const iconPath = itemData[data["奖励物品ID"]]["签到图标路径"];
      s.default.loadBundleRes("home", "image/" + iconPath, function (spriteData) {
        if (context && context.node) {
          context.icon.spriteFrame = new cc.SpriteFrame(spriteData); // 设置图标
        }
      });
    }
  };
  _ctor.prototype.onTouchStart = function () {
    $zqcc_OverallSystem.mgrs().soundMgr.playBtnSound();
  };
  cc__decorate([ccp_property(cc.Sprite)], _ctor.prototype, "icon", undefined);
  cc__decorate([ccp_property(cc.Label)], _ctor.prototype, "gameNmae", undefined);
  cc__decorate([ccp_property(cc.Node)], _ctor.prototype, "yilingqu", undefined);
  return cc__decorate([ccp_ccclass], _ctor);
}(c.default);
exports.default = def_SignInItem;